//Life Simulation Meter Header File
//Defines status meters and how they work
//Jeffrey Denton	November 23, 2010

#include <string>


class meter
{
protected:
	const char* name;
	int status;

public:
	//CONSTRUCTORS
		//Default Constructor//
	meter()
	{
		name = "Empty";
		status = 100;
	}
		//Parameterized Constructor//
	meter(char* n, int s)
	{
		SetName(n);
		SetStatus(s);
	}

	//SET FUNCTIONS
		//Sets the name//
	void SetName(char* n)
	{
		name = n;
	}
		//Sets status to a specific number//
	void SetStatus(int s)
	{
		status = s;
	}
	
	//GET FUNCTIONS
		//Returns the name of the meter//
	const char* GetName()
	{
		return name;
	}
		//Returns the current status level of the meter//
	int GetStatus()
	{
		return status;
	}

	//MISC. FUNCTIONS
		//Prints the name and then one bar for every 5 status points//
	void Print()
	{
		printf("%-9s:", name);

		for(int i = 5; i <= status; i += 5)
		{
			printf("|");
		}
		for(int i = status; i <= 100; i += 5)
		{
			printf(" ");
		}
	}
		//Updates the status of the meter//
	void Update(int mod)
	{
		status = status + mod;
		if (status > 100)
		{
			status = 100;
		}

		if (status < 0)
		{
			status = 0;
		}
	}

};